package com.tandashi.springbootstudy01.config;

import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

public class AppUserFilter extends FormAuthenticationFilter {

    @Override
    protected void redirectToLogin(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException {

        servletResponse.setContentType("application/json; charset=utf-8");
        String json = "{\"errCode\":" + 20001 + ",\"errMsg\":\"请重新登陆\"}";
        servletResponse.getWriter().write(json);
    }
}
